package model.savers;

import model.readers.MetroReader;
import exceptions.ReaderNotFoundException;

public class MetroSaversFactory {
	public static MetroSaver getSaver(String path) {
		System.out.println(path);
		String ext = getExtension(path);
		System.out.println(ext);
		for(MetroSaversRegistry.FileFormat format:MetroSaversRegistry.getFormats()) {
			if(format.formatFileNameExtension.equals(ext)) return format.saver;
		}
		return null;
	}
	
	private static String getExtension(String path) {
		return path.substring(path.lastIndexOf('.')+1);
	}
}
